import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    userInfo: {
      name: 'aaa',
      type: 'admin',
    },
    menu: [],
  }),
  getters: {
    isAdmin(state) {
      return state.userInfo.type === 'admin'
    },
  },
  actions: {
    setUserName() {
      this.userInfo.name = 'bbb'
    },
  },
})
